package com.kele.controller;

import com.kele.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.Collection;

/**
 * @Version 2019
 * @Author:kele
 * @Date:2021/8/8
 * @Content:
 * @Description：
 */
@RestController
@RequestMapping("/rest")
public class RestTemplateController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/findAll")
    public Collection<User> findAll(){
        return restTemplate.getForEntity("http://localhost:8010/findAll",Collection.class).getBody();
    }
}
